package com.xzq.erp.controller;

import com.xzq.erp.aspect.ApiOperationLog;
import com.xzq.erp.domain.vo.DashBoardChartVO;
import com.xzq.erp.domain.vo.DashBoardVO;
import com.xzq.erp.service.IDashBoardService;
import com.xzq.erp.utils.Response;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
@Tag(name = "数据统计相关接口")
@RequiredArgsConstructor
@Validated
public class DashBoardController {

    private final IDashBoardService dashBoardService;

    @GetMapping
    @Operation(summary = "获取数据统计信息")
    @ApiOperationLog(description = "获取数据统计信息")
    public Response<DashBoardVO> getDashBoardInfo() {
        return Response.success(dashBoardService.getDashBoardInfo());
    }

    @GetMapping("/chart")
    @Operation(summary = "获取图表数据")
    @ApiOperationLog(description = "获取图表数据")
    public Response<DashBoardChartVO> getChartData() {
        return Response.success(dashBoardService.getChartData());
    }
}
